package com.zzzyh.forumsystemclient.services.impl;

import com.zzzyh.forumsystemclient.common.AppResult;
import com.zzzyh.forumsystemclient.dao.RoleMapper;
import com.zzzyh.forumsystemclient.exception.AppException;
import com.zzzyh.forumsystemclient.model.Role;
import com.zzzyh.forumsystemclient.services.IRoleService;
import com.zzzyh.forumsystemclient.utils.StringUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.zzzyh.forumsystemclient.common.ResultCode;

/**
 * @author 郑雨杭
 * @create 2025/5/30 - 10:33
 */
@Service
public class RoleServicesImpl implements IRoleService {
    @Autowired
    private RoleMapper roleMapper;
    @Override
    public Role selectByName(String name) {
        if(StringUtil.isEmpty(name))
            throw new AppException(AppResult.failed(ResultCode.FAILED_PARAM_ERROR));
        return roleMapper.selectByName(name);
    }
}
